{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1ab344fd",
   "metadata": {},
   "source": [
    "# Chapter 13 Code"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1b0b2f0b",
   "metadata": {},
   "source": [
    "Script 13-1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6be3cae1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: igraph in /Users/franckm/opt/anaconda3/lib/python3.9/site-packages (0.10.4)\n",
      "Requirement already satisfied: texttable>=1.6.2 in /Users/franckm/opt/anaconda3/lib/python3.9/site-packages (from igraph) (1.6.7)\n",
      "Requirement already satisfied: pycairo in /Users/franckm/opt/anaconda3/lib/python3.9/site-packages (1.23.0)\n"
     ]
    }
   ],
   "source": [
    "#install igraph and pycairo\n",
    "!pip install igraph\n",
    "!pip install pycairo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6f5b8e92",
   "metadata": {},
   "outputs": [],
   "source": [
    "#import igraph, pandas, and numpy\n",
    "import igraph as ig\n",
    "from igraph import Graph\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "9a810c28",
   "metadata": {},
   "outputs": [],
   "source": [
    "#import adjacency matrix\n",
    "File = \"/Users/franckm/Documents/draftcodefiles/DRC_Transport.csv\"\n",
    "pwd = os.getcwd()\n",
    "os.chdir(os.path.dirname(File))\n",
    "mydata = pd.read_csv(os.path.basename(File),encoding='latin1',header=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b024eb6e",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/franckm/opt/anaconda3/lib/python3.9/site-packages/scipy/__init__.py:146: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.25.2\n",
      "  warnings.warn(f\"A NumPy version >={np_minversion} and <{np_maxversion}\"\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"200pt\" height=\"200pt\" viewBox=\"0 0 200 200\" version=\"1.1\">\n",
       "<defs>\n",
       "<g>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-0\">\n",
       "<path style=\"stroke:none;\" d=\"M 0.453125 0 L 0.453125 -10.042969 L 8.421875 -10.042969 L 8.421875 0 Z M 7.164062 -1.257812 L 7.164062 -8.785156 L 1.710938 -8.785156 L 1.710938 -1.257812 Z M 7.164062 -1.257812 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-1\">\n",
       "<path style=\"stroke:none;\" d=\"M 4.839844 -5.796875 C 5.414062 -5.796875 5.859375 -5.875 6.179688 -6.035156 C 6.679688 -6.285156 6.929688 -6.738281 6.929688 -7.390625 C 6.929688 -8.046875 6.664062 -8.488281 6.132812 -8.714844 C 5.832031 -8.84375 5.382812 -8.90625 4.792969 -8.90625 L 2.367188 -8.90625 L 2.367188 -5.796875 Z M 5.296875 -1.164062 C 6.132812 -1.164062 6.726562 -1.402344 7.082031 -1.886719 C 7.304688 -2.191406 7.417969 -2.5625 7.417969 -2.992188 C 7.417969 -3.722656 7.089844 -4.21875 6.4375 -4.484375 C 6.09375 -4.625 5.636719 -4.695312 5.066406 -4.695312 L 2.367188 -4.695312 L 2.367188 -1.164062 Z M 1.03125 -10.042969 L 5.34375 -10.042969 C 6.519531 -10.042969 7.359375 -9.691406 7.855469 -8.988281 C 8.148438 -8.574219 8.292969 -8.097656 8.292969 -7.554688 C 8.292969 -6.921875 8.113281 -6.402344 7.75 -5.996094 C 7.5625 -5.78125 7.296875 -5.585938 6.945312 -5.40625 C 7.460938 -5.210938 7.84375 -4.992188 8.101562 -4.742188 C 8.550781 -4.304688 8.777344 -3.703125 8.777344 -2.933594 C 8.777344 -2.285156 8.574219 -1.699219 8.167969 -1.175781 C 7.5625 -0.390625 6.597656 0 5.277344 0 L 1.03125 0 Z M 1.03125 -10.042969 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-2\">\n",
       "<path style=\"stroke:none;\" d=\"M 3.953125 -7.484375 C 4.472656 -7.484375 4.972656 -7.363281 5.460938 -7.121094 C 5.949219 -6.875 6.320312 -6.558594 6.578125 -6.171875 C 6.824219 -5.804688 6.984375 -5.375 7.070312 -4.882812 C 7.140625 -4.542969 7.179688 -4.007812 7.179688 -3.265625 L 1.8125 -3.265625 C 1.835938 -2.523438 2.007812 -1.929688 2.335938 -1.480469 C 2.664062 -1.03125 3.175781 -0.804688 3.863281 -0.804688 C 4.503906 -0.804688 5.015625 -1.019531 5.398438 -1.441406 C 5.617188 -1.6875 5.773438 -1.972656 5.867188 -2.296875 L 7.074219 -2.296875 C 7.042969 -2.027344 6.9375 -1.726562 6.757812 -1.398438 C 6.578125 -1.066406 6.375 -0.796875 6.152344 -0.585938 C 5.777344 -0.222656 5.316406 0.0234375 4.765625 0.148438 C 4.46875 0.222656 4.132812 0.257812 3.757812 0.257812 C 2.847656 0.257812 2.074219 -0.0703125 1.441406 -0.734375 C 0.808594 -1.398438 0.492188 -2.328125 0.492188 -3.519531 C 0.492188 -4.695312 0.8125 -5.652344 1.449219 -6.382812 C 2.085938 -7.117188 2.921875 -7.484375 3.953125 -7.484375 Z M 5.914062 -4.246094 C 5.863281 -4.777344 5.746094 -5.203125 5.5625 -5.523438 C 5.226562 -6.117188 4.664062 -6.414062 3.875 -6.414062 C 3.3125 -6.414062 2.835938 -6.207031 2.453125 -5.800781 C 2.070312 -5.390625 1.867188 -4.875 1.84375 -4.246094 Z M 5.914062 -4.246094 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-3\">\n",
       "<path style=\"stroke:none;\" d=\"M 0.902344 -7.320312 L 2.070312 -7.320312 L 2.070312 -6.28125 C 2.417969 -6.710938 2.785156 -7.019531 3.171875 -7.203125 C 3.558594 -7.390625 3.988281 -7.484375 4.464844 -7.484375 C 5.503906 -7.484375 6.203125 -7.125 6.570312 -6.398438 C 6.769531 -6 6.871094 -5.433594 6.871094 -4.695312 L 6.871094 0 L 5.617188 0 L 5.617188 -4.613281 C 5.617188 -5.0625 5.554688 -5.421875 5.421875 -5.695312 C 5.203125 -6.148438 4.804688 -6.378906 4.230469 -6.378906 C 3.9375 -6.378906 3.699219 -6.347656 3.515625 -6.289062 C 3.175781 -6.1875 2.878906 -5.988281 2.625 -5.6875 C 2.421875 -5.445312 2.285156 -5.195312 2.226562 -4.9375 C 2.164062 -4.679688 2.132812 -4.3125 2.132812 -3.835938 L 2.132812 0 L 0.902344 0 Z M 0.902344 -7.320312 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-4\">\n",
       "<path style=\"stroke:none;\" d=\"M 0.902344 -7.289062 L 2.152344 -7.289062 L 2.152344 0 L 0.902344 0 Z M 0.902344 -10.042969 L 2.152344 -10.042969 L 2.152344 -8.648438 L 0.902344 -8.648438 Z M 0.902344 -10.042969 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-5\">\n",
       "<path style=\"stroke:none;\" d=\"M 2.132812 -7.320312 L 2.132812 -2.460938 C 2.132812 -2.085938 2.191406 -1.78125 2.3125 -1.546875 C 2.53125 -1.109375 2.9375 -0.890625 3.535156 -0.890625 C 4.390625 -0.890625 4.972656 -1.273438 5.285156 -2.039062 C 5.453125 -2.449219 5.539062 -3.011719 5.539062 -3.726562 L 5.539062 -7.320312 L 6.765625 -7.320312 L 6.765625 0 L 5.605469 0 L 5.617188 -1.078125 C 5.460938 -0.800781 5.261719 -0.566406 5.023438 -0.375 C 4.554688 0.0078125 3.984375 0.199219 3.316406 0.199219 C 2.273438 0.199219 1.5625 -0.148438 1.183594 -0.847656 C 0.976562 -1.222656 0.875 -1.71875 0.875 -2.34375 L 0.875 -7.320312 Z M 2.132812 -7.320312 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-6\">\n",
       "<path style=\"stroke:none;\" d=\"M 1.84375 -1.949219 C 1.84375 -1.59375 1.976562 -1.3125 2.234375 -1.109375 C 2.496094 -0.902344 2.804688 -0.800781 3.15625 -0.800781 C 3.589844 -0.800781 4.011719 -0.898438 4.414062 -1.101562 C 5.097656 -1.433594 5.441406 -1.976562 5.441406 -2.734375 L 5.441406 -3.726562 C 5.289062 -3.628906 5.097656 -3.550781 4.859375 -3.484375 C 4.625 -3.421875 4.390625 -3.375 4.164062 -3.351562 L 3.417969 -3.253906 C 2.972656 -3.195312 2.636719 -3.101562 2.414062 -2.972656 C 2.035156 -2.757812 1.84375 -2.417969 1.84375 -1.949219 Z M 4.828125 -4.4375 C 5.109375 -4.472656 5.296875 -4.589844 5.394531 -4.792969 C 5.449219 -4.902344 5.476562 -5.058594 5.476562 -5.265625 C 5.476562 -5.683594 5.328125 -5.988281 5.027344 -6.175781 C 4.730469 -6.367188 4.300781 -6.460938 3.746094 -6.460938 C 3.101562 -6.460938 2.648438 -6.285156 2.378906 -5.941406 C 2.226562 -5.75 2.128906 -5.464844 2.085938 -5.085938 L 0.9375 -5.085938 C 0.960938 -5.988281 1.253906 -6.617188 1.816406 -6.96875 C 2.378906 -7.320312 3.03125 -7.5 3.773438 -7.5 C 4.632812 -7.5 5.335938 -7.335938 5.871094 -7.007812 C 6.40625 -6.679688 6.671875 -6.167969 6.671875 -5.476562 L 6.671875 -1.257812 C 6.671875 -1.128906 6.699219 -1.027344 6.75 -0.949219 C 6.804688 -0.871094 6.914062 -0.835938 7.082031 -0.835938 C 7.136719 -0.835938 7.199219 -0.835938 7.265625 -0.84375 C 7.335938 -0.851562 7.40625 -0.859375 7.484375 -0.875 L 7.484375 0.0351562 C 7.292969 0.0898438 7.148438 0.125 7.046875 0.136719 C 6.945312 0.148438 6.8125 0.15625 6.636719 0.15625 C 6.214844 0.15625 5.90625 0.0078125 5.714844 -0.292969 C 5.613281 -0.453125 5.542969 -0.679688 5.503906 -0.96875 C 5.253906 -0.640625 4.890625 -0.359375 4.421875 -0.117188 C 3.953125 0.125 3.4375 0.246094 2.871094 0.246094 C 2.191406 0.246094 1.636719 0.0390625 1.207031 -0.371094 C 0.777344 -0.785156 0.5625 -1.300781 0.5625 -1.921875 C 0.5625 -2.601562 0.773438 -3.125 1.195312 -3.5 C 1.621094 -3.875 2.175781 -4.105469 2.863281 -4.191406 Z M 4.828125 -4.4375 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-7\">\n",
       "<path style=\"stroke:none;\" d=\"M 1.148438 -9.367188 L 2.390625 -9.367188 L 2.390625 -7.320312 L 3.5625 -7.320312 L 3.5625 -6.316406 L 2.390625 -6.316406 L 2.390625 -1.539062 C 2.390625 -1.28125 2.480469 -1.113281 2.652344 -1.023438 C 2.75 -0.976562 2.90625 -0.949219 3.132812 -0.949219 C 3.191406 -0.949219 3.253906 -0.953125 3.320312 -0.953125 C 3.390625 -0.957031 3.46875 -0.960938 3.5625 -0.96875 L 3.5625 0 C 3.421875 0.0390625 3.273438 0.0703125 3.121094 0.0898438 C 2.96875 0.109375 2.804688 0.117188 2.625 0.117188 C 2.050781 0.117188 1.660156 -0.03125 1.457031 -0.324219 C 1.25 -0.617188 1.148438 -1 1.148438 -1.46875 L 1.148438 -6.316406 L 0.15625 -6.316406 L 0.15625 -7.320312 L 1.148438 -7.320312 Z M 1.148438 -9.367188 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-8\">\n",
       "<path style=\"stroke:none;\" d=\"M 0.902344 -7.320312 L 2.117188 -7.320312 L 2.117188 -6.28125 C 2.410156 -6.640625 2.675781 -6.90625 2.914062 -7.070312 C 3.320312 -7.347656 3.777344 -7.484375 4.292969 -7.484375 C 4.875 -7.484375 5.34375 -7.34375 5.703125 -7.054688 C 5.902344 -6.890625 6.085938 -6.648438 6.25 -6.328125 C 6.523438 -6.722656 6.84375 -7.011719 7.210938 -7.203125 C 7.582031 -7.390625 7.996094 -7.484375 8.457031 -7.484375 C 9.441406 -7.484375 10.109375 -7.128906 10.464844 -6.417969 C 10.65625 -6.035156 10.753906 -5.519531 10.753906 -4.875 L 10.753906 0 L 9.476562 0 L 9.476562 -5.085938 C 9.476562 -5.574219 9.351562 -5.910156 9.109375 -6.089844 C 8.867188 -6.273438 8.566406 -6.363281 8.21875 -6.363281 C 7.734375 -6.363281 7.316406 -6.203125 6.96875 -5.878906 C 6.621094 -5.554688 6.445312 -5.015625 6.445312 -4.257812 L 6.445312 0 L 5.195312 0 L 5.195312 -4.777344 C 5.195312 -5.273438 5.136719 -5.636719 5.015625 -5.867188 C 4.828125 -6.207031 4.480469 -6.378906 3.972656 -6.378906 C 3.507812 -6.378906 3.085938 -6.199219 2.703125 -5.835938 C 2.324219 -5.476562 2.132812 -4.828125 2.132812 -3.882812 L 2.132812 0 L 0.902344 0 Z M 0.902344 -7.320312 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-9\">\n",
       "<path style=\"stroke:none;\" d=\"M 0.804688 -10.078125 L 2.003906 -10.078125 L 2.003906 -6.433594 C 2.273438 -6.785156 2.59375 -7.050781 2.96875 -7.234375 C 3.339844 -7.421875 3.746094 -7.511719 4.183594 -7.511719 C 5.09375 -7.511719 5.835938 -7.199219 6.402344 -6.574219 C 6.96875 -5.945312 7.253906 -5.023438 7.253906 -3.800781 C 7.253906 -2.644531 6.972656 -1.679688 6.414062 -0.914062 C 5.851562 -0.148438 5.074219 0.234375 4.082031 0.234375 C 3.523438 0.234375 3.054688 0.0976562 2.671875 -0.171875 C 2.445312 -0.332031 2.203125 -0.585938 1.941406 -0.9375 L 1.941406 0 L 0.804688 0 Z M 4.007812 -0.855469 C 4.671875 -0.855469 5.167969 -1.117188 5.5 -1.648438 C 5.828125 -2.175781 5.996094 -2.875 5.996094 -3.738281 C 5.996094 -4.507812 5.828125 -5.148438 5.5 -5.652344 C 5.167969 -6.160156 4.683594 -6.414062 4.039062 -6.414062 C 3.480469 -6.414062 2.988281 -6.203125 2.566406 -5.789062 C 2.144531 -5.375 1.933594 -4.691406 1.933594 -3.738281 C 1.933594 -3.050781 2.019531 -2.492188 2.195312 -2.0625 C 2.519531 -1.257812 3.121094 -0.855469 4.007812 -0.855469 Z M 4.007812 -0.855469 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-10\">\n",
       "<path style=\"stroke:none;\" d=\"M 3.808594 -0.792969 C 4.625 -0.792969 5.183594 -1.101562 5.484375 -1.71875 C 5.789062 -2.335938 5.941406 -3.023438 5.941406 -3.78125 C 5.941406 -4.464844 5.832031 -5.019531 5.613281 -5.449219 C 5.265625 -6.125 4.667969 -6.460938 3.820312 -6.460938 C 3.070312 -6.460938 2.523438 -6.171875 2.179688 -5.597656 C 1.839844 -5.023438 1.667969 -4.332031 1.667969 -3.519531 C 1.667969 -2.742188 1.839844 -2.09375 2.179688 -1.570312 C 2.523438 -1.050781 3.066406 -0.792969 3.808594 -0.792969 Z M 3.855469 -7.53125 C 4.796875 -7.53125 5.597656 -7.21875 6.25 -6.589844 C 6.898438 -5.960938 7.226562 -5.035156 7.226562 -3.8125 C 7.226562 -2.632812 6.9375 -1.660156 6.363281 -0.890625 C 5.789062 -0.117188 4.898438 0.265625 3.691406 0.265625 C 2.683594 0.265625 1.882812 -0.0742188 1.292969 -0.753906 C 0.699219 -1.4375 0.402344 -2.351562 0.402344 -3.5 C 0.402344 -4.730469 0.714844 -5.710938 1.339844 -6.4375 C 1.964844 -7.167969 2.804688 -7.53125 3.855469 -7.53125 Z M 3.855469 -7.53125 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-11\">\n",
       "<path style=\"stroke:none;\" d=\"M 1.066406 -10.042969 L 2.390625 -10.042969 L 2.390625 -5.148438 L 7.289062 -10.042969 L 9.167969 -10.042969 L 4.992188 -5.996094 L 9.28125 0 L 7.511719 0 L 4 -5.039062 L 2.390625 -3.5 L 2.390625 0 L 1.066406 0 Z M 1.066406 -10.042969 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-12\">\n",
       "<path style=\"stroke:none;\" d=\"M 0.9375 -10.042969 L 2.167969 -10.042969 L 2.167969 0 L 0.9375 0 Z M 0.9375 -10.042969 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-13\">\n",
       "<path style=\"stroke:none;\" d=\"M 3.484375 -7.453125 C 4.058594 -7.453125 4.5625 -7.308594 4.992188 -7.027344 C 5.222656 -6.867188 5.460938 -6.636719 5.703125 -6.328125 L 5.703125 -7.253906 L 6.835938 -7.253906 L 6.835938 -0.59375 C 6.835938 0.335938 6.699219 1.070312 6.425781 1.605469 C 5.914062 2.601562 4.953125 3.097656 3.535156 3.097656 C 2.746094 3.097656 2.082031 2.921875 1.546875 2.566406 C 1.007812 2.214844 0.707031 1.660156 0.640625 0.910156 L 1.894531 0.910156 C 1.953125 1.238281 2.070312 1.492188 2.25 1.667969 C 2.527344 1.941406 2.964844 2.078125 3.5625 2.078125 C 4.503906 2.078125 5.121094 1.746094 5.414062 1.078125 C 5.585938 0.6875 5.667969 -0.0117188 5.652344 -1.019531 C 5.40625 -0.644531 5.109375 -0.367188 4.765625 -0.183594 C 4.417969 0 3.960938 0.0898438 3.390625 0.0898438 C 2.597656 0.0898438 1.902344 -0.191406 1.308594 -0.753906 C 0.714844 -1.316406 0.417969 -2.25 0.417969 -3.546875 C 0.417969 -4.773438 0.714844 -5.730469 1.316406 -6.417969 C 1.914062 -7.105469 2.640625 -7.453125 3.484375 -7.453125 Z M 5.703125 -3.691406 C 5.703125 -4.597656 5.515625 -5.269531 5.140625 -5.707031 C 4.765625 -6.144531 4.289062 -6.363281 3.710938 -6.363281 C 2.84375 -6.363281 2.253906 -5.957031 1.933594 -5.148438 C 1.765625 -4.714844 1.679688 -4.148438 1.679688 -3.445312 C 1.679688 -2.621094 1.847656 -1.992188 2.183594 -1.5625 C 2.519531 -1.132812 2.96875 -0.914062 3.535156 -0.914062 C 4.417969 -0.914062 5.039062 -1.316406 5.398438 -2.113281 C 5.601562 -2.5625 5.703125 -3.089844 5.703125 -3.691406 Z M 5.703125 -3.691406 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-14\">\n",
       "<path style=\"stroke:none;\" d=\"M 1.46875 -7.320312 L 2.878906 -1.550781 L 4.304688 -7.320312 L 5.6875 -7.320312 L 7.125 -1.585938 L 8.621094 -7.320312 L 9.851562 -7.320312 L 7.726562 0 L 6.445312 0 L 4.957031 -5.667969 L 3.515625 0 L 2.234375 0 L 0.125 -7.320312 Z M 1.46875 -7.320312 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-15\">\n",
       "<path style=\"stroke:none;\" d=\"M 1.03125 -10.042969 L 2.980469 -10.042969 L 5.867188 -1.550781 L 8.730469 -10.042969 L 10.65625 -10.042969 L 10.65625 0 L 9.367188 0 L 9.367188 -5.925781 C 9.367188 -6.132812 9.371094 -6.472656 9.378906 -6.945312 C 9.386719 -7.417969 9.390625 -7.925781 9.390625 -8.46875 L 6.527344 0 L 5.179688 0 L 2.296875 -8.46875 L 2.296875 -8.164062 C 2.296875 -7.917969 2.300781 -7.542969 2.3125 -7.039062 C 2.324219 -6.535156 2.332031 -6.164062 2.332031 -5.925781 L 2.332031 0 L 1.03125 0 Z M 1.03125 -10.042969 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-16\">\n",
       "<path style=\"stroke:none;\" d=\"M 0.875 -10.042969 L 2.058594 -10.042969 L 2.058594 -4.210938 L 5.214844 -7.320312 L 6.789062 -7.320312 L 3.984375 -4.578125 L 6.945312 0 L 5.375 0 L 3.089844 -3.691406 L 2.058594 -2.75 L 2.058594 0 L 0.875 0 Z M 0.875 -10.042969 \"/>\n",
       "</symbol>\n",
       "<symbol overflow=\"visible\" id=\"glyph0-17\">\n",
       "<path style=\"stroke:none;\" d=\"M 1.679688 -3.574219 C 1.679688 -2.789062 1.847656 -2.136719 2.179688 -1.605469 C 2.511719 -1.078125 3.046875 -0.8125 3.78125 -0.8125 C 4.351562 -0.8125 4.816406 -1.058594 5.183594 -1.546875 C 5.550781 -2.039062 5.734375 -2.742188 5.734375 -3.65625 C 5.734375 -4.582031 5.546875 -5.265625 5.167969 -5.710938 C 4.789062 -6.15625 4.324219 -6.378906 3.765625 -6.378906 C 3.148438 -6.378906 2.644531 -6.140625 2.257812 -5.667969 C 1.875 -5.195312 1.679688 -4.496094 1.679688 -3.574219 Z M 3.535156 -7.453125 C 4.09375 -7.453125 4.5625 -7.332031 4.941406 -7.09375 C 5.160156 -6.957031 5.410156 -6.71875 5.6875 -6.378906 L 5.6875 -10.078125 L 6.871094 -10.078125 L 6.871094 0 L 5.761719 0 L 5.761719 -1.019531 C 5.476562 -0.566406 5.136719 -0.242188 4.742188 -0.0390625 C 4.351562 0.160156 3.902344 0.257812 3.398438 0.257812 C 2.582031 0.257812 1.875 -0.0820312 1.277344 -0.769531 C 0.679688 -1.453125 0.382812 -2.367188 0.382812 -3.507812 C 0.382812 -4.574219 0.65625 -5.496094 1.199219 -6.277344 C 1.742188 -7.058594 2.523438 -7.453125 3.535156 -7.453125 Z M 3.535156 -7.453125 \"/>\n",
       "</symbol>\n",
       "</g>\n",
       "</defs>\n",
       "<g id=\"surface2\">\n",
       "<rect x=\"0\" y=\"0\" width=\"200\" height=\"200\" style=\"fill:rgb(100%,100%,100%);fill-opacity:1;stroke:none;\"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 180 148.757812 C 178.714844 150.386719 177.132812 153.261719 178.222656 154.3125 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 167.945312 144.414062 L 181.4375 150.972656 L 175.007812 157.648438 L 167.945312 144.414062 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 180 148.757812 C 175.226562 155.339844 160.921875 159.695312 160.957031 161.363281 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 160.679688 147.097656 L 165.589844 161.273438 L 156.320312 161.453125 L 160.679688 147.097656 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 180 148.757812 C 181.386719 148.730469 182.800781 146.785156 182.625 146.707031 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 169.507812 141.09375 L 184.445312 142.445312 L 180.800781 150.96875 L 169.507812 141.09375 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 180 148.757812 C 179.734375 142.355469 171.335938 136.691406 171.679688 133.703125 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 173.300781 119.53125 L 176.285156 134.230469 L 167.074219 133.175781 L 173.300781 119.53125 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 180 148.757812 C 169.425781 145.429688 155.023438 132.246094 158.621094 128.078125 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 167.949219 117.285156 L 162.128906 131.109375 L 155.113281 125.046875 L 167.949219 117.285156 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 180 148.757812 C 169.074219 144.878906 156.777344 146.546875 153.4375 157.042969 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 149.117188 170.640625 L 149.019531 155.640625 L 157.855469 158.449219 L 149.117188 170.640625 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 180 148.757812 C 176.808594 136.230469 167.253906 125.371094 155.832031 129.292969 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 142.339844 133.925781 L 154.328125 124.910156 L 157.339844 133.679688 L 142.339844 133.925781 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 160.488281 137.234375 C 155.03125 141.886719 155.324219 154.347656 156.714844 154.03125 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 170.628906 150.878906 L 157.738281 158.550781 L 155.691406 149.511719 L 170.628906 150.878906 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 160.488281 137.234375 C 167.519531 145.160156 167.523438 154.109375 157.984375 158.203125 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 171.097656 152.578125 L 159.8125 162.460938 L 156.160156 153.941406 L 171.097656 152.578125 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 160.488281 137.234375 C 153.070312 140.53125 152.625 153.125 155.582031 152.652344 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 169.667969 150.40625 L 156.3125 157.230469 L 154.851562 148.074219 L 169.667969 150.40625 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 160.488281 137.234375 C 161.386719 133.988281 158.292969 128.914062 158.75 128.371094 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 167.949219 117.46875 L 162.292969 131.359375 L 155.207031 125.382812 L 167.949219 117.46875 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 160.488281 137.234375 C 156.238281 133.503906 151.839844 125.164062 154.757812 123.179688 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 166.554688 115.15625 L 157.367188 127.011719 L 152.152344 119.347656 L 166.554688 115.15625 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 160.488281 137.234375 C 147.6875 138.121094 133.273438 147.464844 137.191406 157.375 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 142.4375 170.640625 L 132.878906 159.078125 L 141.5 155.667969 L 142.4375 170.640625 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 160.488281 137.234375 C 161.496094 132.019531 157.636719 124.355469 154.917969 125.773438 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 142.269531 132.363281 L 152.777344 121.660156 L 157.0625 129.882812 L 142.269531 132.363281 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 174.417969 109.804688 C 186.109375 132.148438 180.425781 148.519531 158.445312 160.855469 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 170.882812 153.875 L 160.710938 164.898438 L 156.175781 156.816406 L 170.882812 153.875 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 174.417969 109.804688 C 157.777344 114.773438 147.945312 139.675781 156.910156 142.214844 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 170.632812 146.105469 L 155.644531 146.675781 L 158.171875 137.753906 L 170.632812 146.105469 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 174.417969 109.804688 C 177.980469 135.144531 158.222656 139.160156 141.753906 153.160156 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 152.625 143.921875 L 144.757812 156.691406 L 138.753906 149.628906 L 152.625 143.921875 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 174.417969 109.804688 C 159.042969 102.875 137.976562 120.214844 140.960938 122.46875 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 152.339844 131.074219 L 138.164062 126.167969 L 143.753906 118.773438 L 152.339844 131.074219 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 174.417969 109.804688 C 161.121094 101.640625 139.0625 101.253906 137.136719 113.277344 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 134.878906 127.363281 L 132.5625 112.542969 L 141.714844 114.007812 L 134.878906 127.363281 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 146.140625 180 C 157.09375 184.210938 170.21875 182.824219 173.238281 172.3125 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 177.175781 158.597656 L 177.691406 173.589844 L 168.78125 171.03125 L 177.175781 158.597656 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 146.140625 180 C 160.800781 179.496094 178.953125 166.4375 173.566406 157.914062 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 165.941406 145.855469 L 177.484375 155.4375 L 169.648438 160.390625 L 165.941406 145.855469 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 146.140625 180 C 159.246094 170.167969 165.863281 144.160156 157.152344 142.246094 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 143.214844 139.191406 L 158.144531 137.71875 L 156.15625 146.777344 L 143.214844 139.191406 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 133.332031 137.019531 C 136.523438 149.464844 145.957031 160.132812 157.382812 156.316406 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 170.914062 151.796875 L 158.851562 160.710938 L 155.914062 151.921875 L 170.914062 151.796875 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 133.332031 137.019531 C 132.402344 142.222656 136.269531 149.785156 139.042969 148.347656 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 151.707031 141.785156 L 141.175781 152.464844 L 136.910156 144.230469 L 151.707031 141.785156 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 133.332031 137.019531 C 143.785156 140.136719 150.644531 135.90625 157.890625 127.953125 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 167.496094 117.402344 L 161.316406 131.074219 L 154.464844 124.832031 L 167.496094 117.402344 \"/>\n",
       "<path style=\"fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(26.666667%,26.666667%,26.666667%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 133.332031 137.019531 C 123.53125 145.171875 117.335938 160.859375 126.25 166.785156 \"/>\n",
       "<path style=\" stroke:none;fill-rule:nonzero;fill:rgb(26.666667%,26.666667%,26.666667%);fill-opacity:1;\" d=\"M 138.132812 174.679688 L 123.6875 170.644531 L 128.816406 162.921875 L 138.132812 174.679688 \"/>\n",
       "<path style=\"fill-rule:nonzero;fill:rgb(100%,0%,0%);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 190 148.757812 C 190 154.28125 185.523438 158.757812 180 158.757812 C 174.476562 158.757812 170 154.28125 170 148.757812 C 170 143.234375 174.476562 138.757812 180 138.757812 C 185.523438 138.757812 190 143.234375 190 148.757812 \"/>\n",
       "<path style=\"fill-rule:nonzero;fill:rgb(100%,0%,0%);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 170.488281 137.234375 C 170.488281 142.753906 166.011719 147.234375 160.488281 147.234375 C 154.964844 147.234375 150.488281 142.753906 150.488281 137.234375 C 150.488281 131.710938 154.964844 127.234375 160.488281 127.234375 C 166.011719 127.234375 170.488281 131.710938 170.488281 137.234375 \"/>\n",
       "<path style=\"fill-rule:nonzero;fill:rgb(100%,0%,0%);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 184.417969 109.804688 C 184.417969 115.328125 179.9375 119.804688 174.417969 119.804688 C 168.894531 119.804688 164.417969 115.328125 164.417969 109.804688 C 164.417969 104.28125 168.894531 99.804688 174.417969 99.804688 C 179.9375 99.804688 184.417969 104.28125 184.417969 109.804688 \"/>\n",
       "<path style=\"fill-rule:nonzero;fill:rgb(100%,0%,0%);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 93.023438 20 C 93.023438 25.523438 88.546875 30 83.023438 30 C 77.503906 30 73.023438 25.523438 73.023438 20 C 73.023438 14.476562 77.503906 10 83.023438 10 C 88.546875 10 93.023438 14.476562 93.023438 20 \"/>\n",
       "<path style=\"fill-rule:nonzero;fill:rgb(100%,0%,0%);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 156.140625 180 C 156.140625 185.523438 151.660156 190 146.140625 190 C 140.617188 190 136.140625 185.523438 136.140625 180 C 136.140625 174.476562 140.617188 170 146.140625 170 C 151.660156 170 156.140625 174.476562 156.140625 180 \"/>\n",
       "<path style=\"fill-rule:nonzero;fill:rgb(100%,0%,0%);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 143.332031 137.019531 C 143.332031 142.542969 138.855469 147.019531 133.332031 147.019531 C 127.808594 147.019531 123.332031 142.542969 123.332031 137.019531 C 123.332031 131.5 127.808594 127.019531 133.332031 127.019531 C 138.855469 127.019531 143.332031 131.5 143.332031 137.019531 \"/>\n",
       "<path style=\"fill-rule:nonzero;fill:rgb(100%,0%,0%);fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" d=\"M 30 146.464844 C 30 151.988281 25.523438 156.464844 20 156.464844 C 14.476562 156.464844 10 151.988281 10 146.464844 C 10 140.941406 14.476562 136.464844 20 136.464844 C 25.523438 136.464844 30 140.941406 30 146.464844 \"/>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph0-1\" x=\"165.953125\" y=\"155.390625\"/>\n",
       "  <use xlink:href=\"#glyph0-2\" x=\"175.291016\" y=\"155.390625\"/>\n",
       "  <use xlink:href=\"#glyph0-3\" x=\"183.077148\" y=\"155.390625\"/>\n",
       "  <use xlink:href=\"#glyph0-4\" x=\"190.863281\" y=\"155.390625\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph0-1\" x=\"142.21875\" y=\"143.863281\"/>\n",
       "  <use xlink:href=\"#glyph0-5\" x=\"151.556641\" y=\"143.863281\"/>\n",
       "  <use xlink:href=\"#glyph0-3\" x=\"159.342773\" y=\"143.863281\"/>\n",
       "  <use xlink:href=\"#glyph0-4\" x=\"167.128906\" y=\"143.863281\"/>\n",
       "  <use xlink:href=\"#glyph0-6\" x=\"170.239258\" y=\"143.863281\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph0-1\" x=\"146.164062\" y=\"116.453125\"/>\n",
       "  <use xlink:href=\"#glyph0-5\" x=\"155.501953\" y=\"116.453125\"/>\n",
       "  <use xlink:href=\"#glyph0-7\" x=\"163.288086\" y=\"116.453125\"/>\n",
       "  <use xlink:href=\"#glyph0-2\" x=\"167.177734\" y=\"116.453125\"/>\n",
       "  <use xlink:href=\"#glyph0-8\" x=\"174.963867\" y=\"116.453125\"/>\n",
       "  <use xlink:href=\"#glyph0-9\" x=\"186.625977\" y=\"116.453125\"/>\n",
       "  <use xlink:href=\"#glyph0-10\" x=\"194.412109\" y=\"116.453125\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph0-11\" x=\"51.113281\" y=\"26.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-6\" x=\"60.451172\" y=\"26.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-12\" x=\"68.237305\" y=\"26.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-5\" x=\"71.347656\" y=\"26.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-3\" x=\"79.133789\" y=\"26.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-13\" x=\"86.919922\" y=\"26.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-5\" x=\"94.706055\" y=\"26.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-7\" x=\"102.492188\" y=\"26.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-6\" x=\"106.381836\" y=\"26.632812\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph0-11\" x=\"126.300781\" y=\"186.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-6\" x=\"135.638672\" y=\"186.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-7\" x=\"143.424805\" y=\"186.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-14\" x=\"147.314453\" y=\"186.632812\"/>\n",
       "  <use xlink:href=\"#glyph0-6\" x=\"157.424805\" y=\"186.632812\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph0-15\" x=\"102.746094\" y=\"143.667969\"/>\n",
       "  <use xlink:href=\"#glyph0-6\" x=\"114.408203\" y=\"143.667969\"/>\n",
       "  <use xlink:href=\"#glyph0-9\" x=\"122.194336\" y=\"143.667969\"/>\n",
       "  <use xlink:href=\"#glyph0-6\" x=\"129.980469\" y=\"143.667969\"/>\n",
       "  <use xlink:href=\"#glyph0-12\" x=\"137.766602\" y=\"143.667969\"/>\n",
       "  <use xlink:href=\"#glyph0-6\" x=\"140.876953\" y=\"143.667969\"/>\n",
       "  <use xlink:href=\"#glyph0-16\" x=\"148.663086\" y=\"143.667969\"/>\n",
       "  <use xlink:href=\"#glyph0-10\" x=\"155.663086\" y=\"143.667969\"/>\n",
       "</g>\n",
       "<g style=\"fill:rgb(0%,0%,0%);fill-opacity:1;\">\n",
       "  <use xlink:href=\"#glyph0-15\" x=\"-9.15625\" y=\"153.113281\"/>\n",
       "  <use xlink:href=\"#glyph0-6\" x=\"2.505859\" y=\"153.113281\"/>\n",
       "  <use xlink:href=\"#glyph0-3\" x=\"10.291992\" y=\"153.113281\"/>\n",
       "  <use xlink:href=\"#glyph0-17\" x=\"18.078125\" y=\"153.113281\"/>\n",
       "  <use xlink:href=\"#glyph0-4\" x=\"25.864258\" y=\"153.113281\"/>\n",
       "  <use xlink:href=\"#glyph0-8\" x=\"28.974609\" y=\"153.113281\"/>\n",
       "  <use xlink:href=\"#glyph0-6\" x=\"40.636719\" y=\"153.113281\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<igraph.drawing.cairo.plot.CairoPlot at 0x7fdda308f0d0>"
      ]
     },
     "execution_count": 4,
     "metadata": {
      "image/svg+xml": {
       "isolated": true
      }
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#create and plot graph\n",
    "g_transport=Graph.Adjacency(mydata,directed=False,weighted=True)\n",
    "ig.plot(g_transport,bbox=(200,200),vertex_label=[\"Beni\",\"Bunia\",\"Butembo\",\"Kalunguta\",\"Katwa\",\n",
    "                                                \"Mabalako\",\"Mandima\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "eb185927",
   "metadata": {},
   "outputs": [],
   "source": [
    "#calculate betweenness and degree centrality\n",
    "bet=Graph.betweenness(g_transport)\n",
    "deg=Graph.degree(g_transport)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "af15ad2e",
   "metadata": {},
   "outputs": [],
   "source": [
    "#create vector to add to dataset\n",
    "degree=deg+deg+deg+deg+deg\n",
    "betweenness=bet+bet+bet+bet+bet"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "84fc4471",
   "metadata": {},
   "outputs": [],
   "source": [
    "#import Ebola dataset\n",
    "File = \"/Users/franckm/Documents/draftcodefiles/Ebola_Data.csv\"\n",
    "pwd = os.getcwd()\n",
    "os.chdir(os.path.dirname(File))\n",
    "data = pd.read_csv(os.path.basename(File),encoding='latin1')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "4d1e415a",
   "metadata": {},
   "outputs": [],
   "source": [
    "#add degree and betweenness to Ebola dataset\n",
    "degree=np.array(degree)\n",
    "betweenness=np.array(betweenness)\n",
    "data['Betweenness']=betweenness\n",
    "data['Degree']=degree"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "43e95586",
   "metadata": {},
   "source": [
    "Script 13-2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "c51a4863",
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "module 'numpy' has no attribute 'MachAr'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[0;32m/var/folders/31/w56d47t956zfp0kklgtz_yq40000gn/T/ipykernel_4342/1832413844.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0;31m#load packages\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mstatsmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapi\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0msm\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      3\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mstatsmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformula\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapi\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0msmf\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/statsmodels/api.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      7\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mtools\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      8\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mtools\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtools\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0madd_constant\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcategorical\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mregression\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     10\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mregression\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlinear_model\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mOLS\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mGLS\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mWLS\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mGLSAR\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     11\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mregression\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecursive_ls\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mRecursiveLS\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/statsmodels/regression/__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mlinear_model\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0myule_walker\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mstatsmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtools\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_testing\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mPytestTester\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m \u001b[0m__all__\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'yule_walker'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'test'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/statsmodels/regression/linear_model.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m     44\u001b[0m from statsmodels.tools.decorators import (cache_readonly,\n\u001b[1;32m     45\u001b[0m                                           cache_writable)\n\u001b[0;32m---> 46\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mstatsmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbase\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodel\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mbase\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     47\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mstatsmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbase\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwrapper\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mwrap\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     48\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mstatsmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0memplike\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0melregress\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0m_ELRegOpts\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/statsmodels/base/model.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m     14\u001b[0m                                           cached_value, cached_data)\n\u001b[1;32m     15\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mstatsmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbase\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwrapper\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mwrap\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 16\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mstatsmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtools\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnumdiff\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mapprox_fprime\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     17\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mstatsmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtools\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msm_exceptions\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mValueWarning\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m\\\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     18\u001b[0m     \u001b[0mHessianInversionWarning\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/statsmodels/tools/numdiff.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m     49\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     50\u001b[0m \u001b[0;31m# NOTE: we only do double precision internally so far\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 51\u001b[0;31m \u001b[0mEPS\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mMachAr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0meps\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     52\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     53\u001b[0m _hessian_docs = \"\"\"\n",
      "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/numpy/__init__.py\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(attr)\u001b[0m\n\u001b[1;32m    326\u001b[0m             \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Tester was removed in NumPy 1.25.\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    327\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 328\u001b[0;31m         raise AttributeError(\"module {!r} has no attribute \"\n\u001b[0m\u001b[1;32m    329\u001b[0m                              \"{!r}\".format(__name__, attr))\n\u001b[1;32m    330\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mAttributeError\u001b[0m: module 'numpy' has no attribute 'MachAr'"
     ]
    }
   ],
   "source": [
    "#load packages\n",
    "import statsmodels.api as sm\n",
    "import statsmodels.formula.api as smf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "54ab6978",
   "metadata": {},
   "outputs": [],
   "source": [
    "#define GEE parameters\n",
    "family=sm.families.Poisson() #count data\n",
    "cov_str=sm.cov_struct.Exchangeable() #data-derived covariance structure"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5ecf6c6b",
   "metadata": {},
   "outputs": [],
   "source": [
    "#create GEE model predicting Ebola cases\n",
    "model=smf.gee(\"Ebola_Cases~Province+Violent_Incidents+Disasters+Degree+Betweenness\",\"Town\",data,cov_struct=cov_str,\n",
    "              family=family)\n",
    "results=model.fit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "02ece723",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'results' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m/var/folders/31/w56d47t956zfp0kklgtz_yq40000gn/T/ipykernel_4342/1195746269.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0;31m#examine resulting model\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mresults\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msummary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m: name 'results' is not defined"
     ]
    }
   ],
   "source": [
    "#examine resulting model\n",
    "results.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b88e1e34",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
